﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.UI.Selection;

namespace YArchitech.Revit
{
	public class HorizonDuctFilter : ISelectionFilter
	{
		public bool AllowElement(Element elem)
		{
			if (elem is Duct)
			{
				LocationCurve locationCurve = (elem as Duct).Location as LocationCurve;
				if (Math.Abs(locationCurve.Curve.GetEndPoint(0).Z - locationCurve.Curve.GetEndPoint(1).Z) < 0.0032808398950131233)
				{
					return true;
				}
			}
			return false;
		}

		public bool AllowReference(Reference reference, XYZ position)
		{
			throw new NotImplementedException();
		}
	}
}
